package com.heima.service.impl;

import com.heima.dao.BookDao;
import com.heima.domain.Book;
import com.heima.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookDao bookDao;

    public List<Book> findAll() {
        List<Book> list = bookDao.findAll();
        return list;
    }

    public Book findByid(Integer id) {
        Book book = bookDao.findByid(id);
        return book;
    }

    public Boolean save(Book book) {
        Boolean flag = bookDao.save(book);
        return flag ? true : false;
    }

    public Boolean update(Book book) {
        Boolean flag = bookDao.update(book);
        return flag ? true : false;
    }

    public Boolean delete(Integer id) {
        Boolean flag = bookDao.delete(id);
        return flag ? true : false;
    }
}
